package com.tedu;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws FileNotFoundException {
        File dir = new File("E:\\Test");
        if(dir.isDirectory()){
            File []a = dir.listFiles();
            for (int i = 0; i <a.length; i++) {
                if(a[i].isFile()){
                    String a1= a[i].getName();
                    int n = a1.lastIndexOf(".");
                   if(a1.substring(n+1).equals("java")) {
//                       后缀名为java的文件，把内容输出到控制台
                       FileInputStream fi = new FileInputStream(a1);
                       System.out.println(fi);
                   }



                }
            }

        }
    }
}
